package com.example.servlet.StudentServlet;

import com.example.bean.Student;
import com.example.service.StudentShowService;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
import java.io.IOException;

@WebServlet(name = "ShowServlet", value = "/show")
public class ShowServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        this.doPost(request, response);
    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        Student student=new Student();
        StudentShowService studentShowService=new StudentShowService();
        Student student1 = studentShowService.StudentShow(new Student());

        response.setContentType("text/html;charset=utf-8");
        request.getSession().setAttribute("student",student1);
        response.sendRedirect("show.jsp");

    }
}
